
/*
CVolumetricQuatroid class defined
*/

#include "CTetra.h"

using namespace MarCore;
using namespace Tetra;

//! Default Constructor
CTetra::CTetra()
//IGameObject::IGameObject(): rod(0), crank(0)
{

    CTetraVertex* vertices_[4];

    vertices_[0] = new CTetraVertex( core::vector3df(0,0,0) );
    vertices_[1] = new CTetraVertex( core::vector3df(10,0,0) );
    vertices_[2] = new CTetraVertex( core::vector3df(0,10,0) );
    vertices_[3] = new CTetraVertex( core::vector3df(0,0,10) );

    vertices = *vertices_;

    //set mass
    mass = vertices[0].getMass() + vertices[1].getMass() + vertices[2].getMass() + vertices[3].getMass();

    ///@todo

    //mngr_->createBulletTetrahedronBody( &vertices_ );


    active = false;

};

//! Constructor
CTetra::CTetra(  CTetraVertex* vertices_, CTetraManager* mngr, IGameObject* rod, CGameObjectArray* crank )
//    vertices(vertices_), manager( mngr ), buffer(0), IGameObject::IGameObject( rod, crank ): rod( rod ), crank( crank )
{

    goid = 0x00000001;
    //vertices = vertices_; //set vertices

/*
    ///@todo Make this a CMCGlue method.
    mngr_->createBulletTetrahedronBody( &vertices_ );
*/

    active = false; //sets it to default: Not up for simulation

    ///!
    //video::SMaterial* g_MarCoreMaterial;

    ///!
    //material =g_MarCoreMaterial;

    ///@todo
    //material->setTexture()

};

CTetra::~CTetra()
{

};

void CTetra::updateMesh( E_UPDATE_TETRA_MESH update )
{
/*
    switch ( E_UPDATE_TETRA_MESH )
    {

        case E_BOTH:
            updatePhysicsMesh();
            updateGraphicsMesh(); break;

        case E_GRAPHICS:
            updateGraphicsMesh(); break;

        case E_PHYSICS:
            updatePhysicsMesh(); break;

    };
*/
};


void CTetra::updateGraphicsMesh()
{

    //irr_node->getMesh()->getMeshBuffer(0)->setDirty( EBT_VERTEX_AND_INDEX );

};

void CTetra::updatePhysicsMesh()
{

//!

/*

    collision_shape->setVertices(

    btVector3(
        btScalar(vertices[0].getPosition().X),
        btScalar(vertices[0].getPosition().Y),
        btScalar(vertices[0].getPosition().Z) ) ,

    btVector3(
        btScalar(vertices[1].getPosition().X),
        btScalar(vertices[1].getPosition().Y),
        btScalar(vertices[1].getPosition().Z) ) ,

    btVector3(
        btScalar(vertices[2].getPosition().X),
        btScalar(vertices[2].getPosition().Y),
        btScalar(vertices[2].getPosition().Z) ) ,

    btVector3(
        btScalar(vertices[3].getPosition().X),
        btScalar(vertices[3].getPosition().Y),
        btScalar(vertices[3].getPosition().Z) )

    );

*/

};

void CTetra::setNeedsUpdate( bool update )
{

    needsUpdate = update;

};

void CTetra::setTexture()
{

};

CTetraVertex* CTetra::getVertices()
{

    return vertices;

};

const u32 CTetra::getBufferIndex()
{

    return buffer_index;

};

void CTetra::updateMass()
{

};

void CTetra::addCollidedForce( core::vector3df& poc/*point of contact*/, core::vector3df& end )
{

};

void CTetra::setRod( IGameObject* new_rod )
{

};

void CTetra::addCrank( const IGameObject& new_crank )
{

};

//! Run a tick amount.
void CTetra::stroke()
{

};

